public class Demo1 {
    public static void main(String[] args) {
        Object locker = new Object();
        Thread t1 = new Thread(() -> {
            synchronized (locker){
                System.out.println("1111");
                try {
                    locker.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("2222");
            }
        });
        Thread t2 = new Thread(() -> {
            synchronized (locker){
                System.out.println("33333");
                locker.notify();//那把锁调用，唤醒哪个wait
                System.out.println("44444");
            }
        });
        t1.start();
        t2.start();
    }
}
